package com.atguigu.gmall.order.intercepter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/***
 * 拦截器配置
 */
@Configuration
public class IntercepterConfig extends WebMvcConfigurationSupport {

    @Autowired
    private GlobalIntercepter globalIntercepter;

    /**
     * 增加自定义拦截器
     * @param registry
     */
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        //添加，并指定拦截的路径模式
        registry.addInterceptor(globalIntercepter).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
